﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace MyCommon.Seed
{
    public class MyContext
    {
        private SqlSugarScope _sugarClient;
        public MyContext(ISqlSugarClient sugarClient)
        {
            _sugarClient = sugarClient as SqlSugarScope;
        }
        public SqlSugarScope Db
        {
            get { return _sugarClient; }
            private set { _sugarClient = value; }
        }
        /// <summary>
        /// 获取数据库处理对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public SimpleClient<T> GetEntityDB<T>() where T : class,new() {
            return new SimpleClient<T>(_sugarClient);
        }
    }
}
